Algorithms: Professional Edition. Beginner's Guide by Harry

Algorithms: Professional Edition. Beginner's Guide by Harry

Author:Harry [Harry]
Language: eng
Format: epub, azw3
Publisher: Programmers Mind Inc,
Published: 2014-12-07T08:00:00+00:00


APPEND (FIRST, LAST, INFO, BACK, FORW, ITEM, AVAIL)

This procedure adds a new node at the end of a two-way linked list.

1. [OVERFLOW?]

If AVAIL = NULL, then: Write: OVERFLOW and Exit.

2. [Remove the first node from AVAIL list.]

Set NEW: = AVAIL, AVAIL: = FORW [AVAIL].

3. Set INFO [NEW]: = ITEM. [Copies new data into new node.]

4. Set FORW [NEW]: = NULL.

5. If FIRST = NULL, then: [If we are adding first ITEM in the list.]

Set FIRST: =NEW, LAST: = NEW.

Set BACK [NEW]: = NULL.

Else:

Set FORW [LAST]: = NEW.

Set BACK [NEW]: = LAST. [New node now points to original first node.]

Set LAST: = NEW. [Changes LAST so it points to the new node.]

[End of If structure.]

6. Exit.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.